import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/widgets/button/add_button.dart';
import 'package:finance_app/src/widgets/form/form_edit_status_inherited_widget.dart';
import 'package:flutter/material.dart';

class AddForm extends StatelessWidget {
  final String title;
  final VoidCallback onTap;
  final double topPadding;
  final double leftPadding;
  final double rightPadding;

  const AddForm(
      {Key key,
      this.title,
      this.onTap,
      this.topPadding = 15,
      this.leftPadding = 31,
      this.rightPadding = 31})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    bool isEnable = FormEditStatusInheritedWidget.ofEnable(context);
    if (isEnable && onTap != null)
      return Container(
        color: Colors.white,
        padding: EdgeInsets.fromLTRB(getDp(leftPadding), getDp(topPadding),
            getDp(rightPadding), getDp(15)),
        child: AddButton(
          title: title,
          onTap: onTap,
        ),
      );
    else
      return Container();
  }
}
